{% extends 'bootstrap-modal-layout.html.twig' %}
{% do script(['libs/bootstrap-datetimepicker.js','libs/jquery-validation.js','app/js/classroom-manage/student-expiryday/index.js'])%}
{% set modalSize = 'large' %}

{% block title %}{{'classroom.edit_expiry_mode'|trans}}{% endblock %}
{% block body %}

<form id="expiryday-set-form" class="form-horizontal" method="post" action="{{ path('classroom_manage_member_deadline', { classroomId:classroom.id, userId:user.id }) }}">
  {% if classroom.status == 'published' %}
    <div class="row form-group">
      <div class="col-sm-2 control-label width-100">
        <label for="classroom-title">{{'classroom.title_label'|trans}}</label>
      </div>
      <div class="col-sm-7 controls">
        <div style="margin-top: 7px;">
          {{ classroom.title }}
          </div>
      </div>
    </div>

    <div class="row form-group">
      <div class="col-sm-2 control-label width-100">
        <label for="student-nickname">{{ 'classroom.student'|trans }} {{'classroom.username'|trans}}</label>
      </div>
      <div class="col-sm-7 controls">
        <div style="margin-top: 7px;">
          {{ user.nickname|default() }}
          </div>
        </div>
    </div>

    <div class="row form-group">
      <div class="col-sm-2 control-label width-100">
        <label for="set-more-expiryday">{{'classroom.expiry_mode'|trans}}</label>
      </div>
      <div class="col-sm-7 controls">
        <input type="text" id="student_deadline" name="deadline" required="required" {% if member.deadline %}value="{{ member.deadline|date('Y-m-d') }}"{% endif %}class="form-control width-input width-input-large">
        <div class="help-block">
        {{ 'classroom.set_expiry_mode_tips'|trans }}
        </div>
      </div>
    </div>
    <input type="hidden" name="memberId" value="{{ user.id }}">
  {% else %}
    <div class="empty">{{dict_text('classroomStatus', classroom.status)}}{{'classroom.not_edit'|trans}}{{ 'classroom.student'|trans }}{{'classroom.publish_tips'|trans}}</div>
  {% endif %}
</form>

{% endblock %}

{% block footer %}
  <button class="btn btn-primary pull-right" type="button" id="student-save" data-loading-text="{{'form.btn.save.submiting'|trans}}">{{'form.btn.save'|trans}}</button>
  <button type="button" class="btn btn-link pull-right" data-dismiss="modal">{{'form.btn.cancel'|trans}}</button>
{% endblock %}
